package com.situ.day25.singleton;

import org.junit.Test;

public class SingletonDemo {

    @Test
    public void test1() {
        //Singleton singleton1 = new Singleton();
        //Singleton singleton2 = new Singleton();

        Singleton1 instance1 = Singleton1.getInstance();
        Singleton1 instance2 = Singleton1.getInstance();
        System.out.println(instance1 == instance2);//true
    }

    @Test
    public void test2() {
        Singleton2 instance1 = Singleton2.getInstance();
        Singleton2 instance2 = Singleton2.getInstance();
        System.out.println(instance1 == instance2);//true
    }

    @Test
    public void test3() {
        Singleton5 instance1 = Singleton5.getInstance();
        Singleton5 instance2 = Singleton5.getInstance();
        System.out.println(instance1 == instance2);//true
    }
}
